//package com.matt.components.runner;
//
//import com.matt.domain.course.VideoTemp;
//import com.matt.foundation.ext.aliyun.MNSProcessService;
//import com.matt.foundation.utils.JsonValidateUtil;
//import com.matt.foundation.utils.ModelUtil;
//import com.matt.repository.course.VideoTempRepository;
//import com.matt.service.CourseService;
//import lombok.extern.slf4j.Slf4j;
//import org.apache.commons.lang.StringUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.boot.CommandLineRunner;
//import org.springframework.core.annotation.Order;
//
//
//@Order(1)
//@Slf4j
//public class StartupRunner implements CommandLineRunner {
//
//    @Autowired
//    private MNSProcessService mnsProcessService;
//
//    @Autowired
//    private CourseService courseService;
//
//
//
//    @Value("${spring.profiles.active}")
//    private String env;
//
//
//    @Override
//    public void run(String... args) throws Exception {
//        EventThread eventThread = new EventThread();
//        eventThread.start();
//    }
//
//    class EventThread extends Thread {
//        @Override
//        public void run() {
//            while (true) {
//                try {
//                    String body = mnsProcessService.consumer(env + "Video");
//                    if (StringUtils.isNotBlank(body)) {
//                        String type = JsonValidateUtil.getMSNMessageType(body);
//                        if ("Report".equals(type)) {
//                            String videoURL = JsonValidateUtil.getMSNMessageObject(body);
////                            if (videoURL.contains("_mv_official") || videoURL.contains("_mv_area"))
//                            courseService.videoCompressNotice(videoURL);
//                        }
//                    }
//                    Thread.sleep(5000);
//                } catch (Exception e) {
//                    e.printStackTrace();
//                }
//            }
//        }
//    }
//
//}
